package com.aiit.service.Impl;

import com.aiit.mapper.CompanyMapper;
import com.aiit.pojo.Company;
import com.aiit.service.CompanyService;
import com.aiit.vo.PageResultVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: LuTao
 * @Date: 2022/05/06/10:26
 */
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public PageResultVo<Company> getByCondition(Long page, Long limit, String name, String listedStatus, String size, String startDate, String endDate) {
        PageResultVo<Company> pageResultVo = new PageResultVo<>();
        pageResultVo.setRecords(companyMapper.getByCondition((page-1)*limit,limit,name,listedStatus,size,startDate,endDate));
        pageResultVo.setTotal(companyMapper.getCountByCondition(name,listedStatus,size,startDate,endDate));
        return pageResultVo;
    }
}
